<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增任务清单')"/>
    <th:block th:include="include :: datetimepicker-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-agile-add">
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">任务内容：</label>
            <div class="col-sm-8">
                <input name="agileName" class="form-control" type="text" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">任务状态：</label>
            <div class="col-sm-8">
                <label class="radio-box">
                    <input name="agileStatus" type="radio" id=0 value=0 required> 未开始</input>
                </label>
                <label class="radio-box">
                    <input name="agileStatus" type="radio" id=1 value=1 required> 进行中</input>
                </label>
                <label class="radio-box">
                    <input name="agileStatus" type="radio" id=2 value="2" required> 完 成</input>
                </label></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">任务时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <input type="text" class="form-control"
                           id="datetimepicker"
                           placeholder="请选择时间"
                           readonly="true" required name="agileDate">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-8">
                <textarea name="remark" class="form-control"></textarea>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<script th:inline="javascript">
    var prefix = ctx + "memorial/agileBoard"

    $("#form-agile-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            var data = $('#form-agile-add').serialize();
            var config = {
                url: prefix + "/add",
                type: "post",
                dataType: "json",
                data: data,
                beforeSend: function () {
                    $.modal.loading("正在处理中，请稍候...");
                    $.modal.disable();
                },
                success: function (result) {
                    if (result.code == 0) {
                        parent.location.reload();
                        $.modal.msgSuccess("保存成功");
                    }
                }
            };
            $.ajax(config)
        }
    }

    // 时间选择
    $(function () {
        <!-- datetimepicker示例 -->
        $("#datetimepicker").datetimepicker({
            format: "yyyy-mm-dd hh:ii",
            minView: 0,
            autoclose: true,
            todayBtn: true,
            language: "zh-cn",
        });
    });
</script>

</body>
</html>
